package com.example.kjn.myapplication.per;

import com.example.kjn.myapplication.bean.UserBean;
import com.example.kjn.myapplication.modle.ModleUser;
import com.example.kjn.myapplication.view.UserView;

/**
 * <pre>
 *     author : kjn
 *     e-mail : xxx@xx
 *     time   : 2017/12/05
 *     desc   :
 * </pre>
 */
public class UserPer implements IUserper {
    private UserView userView;
    private ModleUser modleUser;

    public UserPer(UserView userView) {
        this.userView = userView;
        modleUser = new ModleUser();
    }


    @Override
    public void save() {
        modleUser.save(userView.getId(), userView.getName(), userView.getPSW());
    }

    @Override
    public void load() {
        UserBean load = modleUser.load(userView.getId());
        userView.setName(load.getName());
        userView.setPSW(load.getPassword());
    }
}
